{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import java.util.function.Supplier\n",
    "import java.util.stream.Stream\n",
    "TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS)\n",
    "\n",
    "def generate = Stream.generate(new Supplier<Map<String, Object>>() {\n",
    "    def random = new Random()\n",
    "    def index = 0\n",
    "\n",
    "    @Override\n",
    "    Map<String, Object> get() {\n",
    "        return [\n",
    "            str1: index++,\n",
    "            str2: random.nextDouble(),\n",
    "            str3: random.nextFloat()\n",
    "        ]\n",
    "    }\n",
    "    })\n",
    "\n",
    "new TableDisplay(generate)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import java.util.function.Supplier\n",
    "import java.util.stream.Stream\n",
    "TableDisplay.setLoadingMode(TableDisplayLoadingMode.ENDLESS)\n",
    "\n",
    "def generate = Stream.generate(new Supplier<Map<String, Object>>() {\n",
    "    def random = new Random()\n",
    "    def index = 0\n",
    "\n",
    "    @Override\n",
    "    Map<String, Object> get() {\n",
    "        return [\n",
    "            str1: index++,\n",
    "            str2: random.nextDouble(),\n",
    "            str3: random.nextFloat()\n",
    "        ]\n",
    "    }\n",
    "    })\n",
    "\n",
    "td4 = new TableDisplay(generate)\n",
    "td4.setFontColorProvider { row, col, td ->\n",
    "    row = td.values[row]\n",
    "    val = row[col]\n",
    "    if (val % 10 == 0){\n",
    "        return Color.GREEN\n",
    "    }\n",
    "    return Color.BLACK\n",
    "}\n",
    "\n",
    "td4"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Groovy",
   "language": "groovy",
   "name": "groovy"
  },
  "language_info": {
   "codemirror_mode": "groovy",
   "file_extension": ".groovy",
   "mimetype": "",
   "name": "Groovy",
   "nbconverter_exporter": "",
   "version": "2.5.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": false,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": false,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
